﻿@using System.Collections
@using System.Diagnostics
@model IEnumerable<HotelManageSystem.Models.GodownentryModel>
@{
    ViewBag.Title = "ShowGodownentry";
    Layout = "~/Views/Shared/_Template.cshtml";
}
@section Head {
    <link href= "@Url.Content("~/Content/TelerikGrid.css")"rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function onEdit(e) {
            $(e.form).find('#ProductProviderName').data('tDropDownList').select(function (dataItem) {
                return dataItem.Text == e.dataItem['ProductProviderName'];
            });
        }
  </script>
}
@(
 Html.Telerik()
            .Grid(Model)
            .Name("Grid")
            .DataKeys(keys =>keys.Add(g=>g.ID))
            .ToolBar(commands => commands.Insert())
            .DataBinding(dataBinding => dataBinding.Ajax()
                .Select("TelerikAjax", "Godownentry")
                .Insert("Insert", "Godownentry")
                .Update("Save", "Godownentry")
                .Delete("Delete", "Godownentry"))
                .Sortable(sorting => sorting
                  .SortMode(GridSortMode.SingleColumn)
                      .OrderBy(sortOrder => sortOrder           
                        .Add((string)ViewData["sortMember"])
                       ))
                     .Pageable(paging => paging
                           .Style(GridPagerStyles.NextPreviousAndNumeric)
                           .Position(GridPagerPosition.Bottom)
                           .PageTo((int)ViewData["currentPage"])
                           .PageSize(5))
             .Columns(columns =>
             {
                 columns.Bound(o => o.GodownentryID).Width(280).ReadOnly().Title("入库单号");
                 columns.Bound(o => o.Stockprice).Width(100).Title("单价");
                 columns.Bound(o => o.Count).Width(100).Title("数量");
                 columns.Bound(o => o.Total).Width(100).Title("合计");
                 columns.Bound(o => o.Datetime).Width(240).Title("时间");
                 columns.Bound(o => o.Billproducer).Width(100).Title("制单人");
                 columns.Bound(o => o.ProductName).Width(100).Title("货品名");
                 
                 //columns.Bound(o => o.ProductProviderName).Width(100).Title("供应商");
                 //columns.ForeignKey(o => o.ProductProviderName, new SelectList((IEnumerable) ViewData["productProviderName"]));
                 columns.Bound(o => o.ProductProviderName).Width(100).Title("审核人");
                 //columns.ForeignKey(o => o.employeeName, new SelectList((IEnumerable)ViewData["EmployeeName"], "ID", "Name")).Width(230);
                 columns.Bound(o => o.WarehouseName).Width(100).Title("仓库号");
                 
                 columns.Command(commands =>
            {
                commands.Edit();
                commands.Delete();
             }).Width(200);
             }
             )
             .Editable(editing => editing.Mode(GridEditMode.PopUp))
                     .Pageable()
                 .Scrollable()
                 .Sortable()


            
     
 )
 @*@(
    Html.Telerik().DropDownList()
              .Name("ProductProviderName")
              .BindTo(new SelectList((IEnumerable)ViewData["ProductProviderNames"], "Id", "Name"))
  )*@